<template>
  <!-- <el-switch style="display: block" v-model="show" active-color="#13ce66" inactive-color="#ff4949" > </el-switch> -->

  <el-checkbox v-model="show" label=""></el-checkbox>

  <!-- active-text="开" inactive-text="关" -->
</template>

<script>
export default {
  data() {
    return {
      show: false,
    };
  },

  watch: {
    show: function (val) {
      console.log(val);
      if (val == true) {
        this.$emit("update:number", 1);
      } else {
        this.$emit("update:number", 2);
      }
    },
    number:function(){
      if(this.number==1)  {
        this.show=true;
      }else{
        this.show=false;
      }
    }

  },
  created() {
    if (this.number == 1) {
      this.show = true;
    } else {
      this.show = false;
    }
  },
  props: ["number"],
};
</script>

<style>
</style>